home *** CD-ROM | disk | FTP | other *** search
/ The CICA Windows Explosion! / The CICA Windows Explosion! - Disc 2.iso / programr / spmate13.zip / SPELLTST.CP$ / spelltst.cpp
C/C++ Source or Header  |  1993-07-13  |  2KB  |  87 lines

  1. // ObjectWindows - (C) Copyright 1992 by Borland International
  2.  
  3. // Modifications to demonstrate the SPELMATE DLL spell checker
  4. // (c) 1993, Stewart McSporran for Aciran Software Systems
  5.  
  6. #include <owl.h>
  7. #include <string.h>
  8. #include <filewnd.h>
  9. #include "spelltst.h"
  10. #pragma hdrstop
  11. #include "spell.h"
  12.  
  13. // Declare TFileApp, a TApplication descendant
  14. class TFileApp : public TApplication {
  15. public:
  16.     TFileApp(LPSTR AName, HINSTANCE hInstance, HINSTANCE hPrevInstance,
  17.       LPSTR lpCmdLine, int nCmdShow)
  18.       : TApplication(AName, hInstance, hPrevInstance, lpCmdLine, nCmdShow) {};
  19.     virtual void InitMainWindow();
  20.     virtual void InitInstance();
  21. };
  22.  
  23. // Declare TMyFileWindow, a TFileWindow descendant
  24. class TMyFileWindow : public TFileWindow {
  25. public:
  26.         TMyFileWindow(PTWindowsObject, LPSTR, LPSTR);
  27.         virtual void GetWindowClass(WNDCLASS &wc);
  28.         virtual void CMSpell(RTMessage Msg) = [CM_FIRST + CM_TOOLSSPELL];
  29.         virtual void CMAbout(RTMessage Msg) = [CM_FIRST + CM_ABOUT];
  30. };
  31.  
  32. // Construct a TMyFileWindow, loading its menu
  33. TMyFileWindow::TMyFileWindow(PTWindowsObject AParent, LPSTR ATitle,
  34.   LPSTR AFileName)
  35.   : TFileWindow(AParent, ATitle, AFileName)
  36. {
  37.   AssignMenu("FileCommands");
  38. }
  39.  
  40. void TMyFileWindow::GetWindowClass(WNDCLASS &wc)
  41. {
  42.   TWindow::GetWindowClass(wc);
  43.     wc.hIcon = LoadIcon(wc.hInstance,MAKEINTRESOURCE(100));
  44. }
  45.  
  46. // Construct the TFileApp's MainWindow of type TMyFileWindow
  47. void TFileApp::InitMainWindow()
  48. {
  49.   MainWindow = new TMyFileWindow(NULL, "File Window", "");
  50. }
  51.  
  52. /* Initialize each MS-Windows application instance, loading an
  53.   accelerator table */
  54. void TFileApp::InitInstance()
  55. {
  56.   TApplication::InitInstance();
  57.   if ( Status == 0 )
  58.     HAccTable = LoadAccelerators(hInstance, "FileCommands");
  59. }
  60.  
  61.  
  62. #pragma argsused
  63. void TMyFileWindow::CMSpell(RTMessage Msg)
  64. {
  65.     // spellcheck the edit control used by TFileWindow
  66.     Spell(Editor);
  67. }
  68.  
  69. #pragma argsused
  70. void TMyFileWindow::CMAbout(RTMessage Msg)
  71. {
  72.     TDialog *pAbout;
  73.     pAbout = new TDialog(this,DLG_ABOUT);
  74.     GetModule()->ExecDialog(pAbout);
  75. }
  76.  
  77. // Run the FileApp
  78. int PASCAL WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
  79.   LPSTR lpCmdLine, int nCmdShow)
  80. {
  81.     TFileApp FileApp ("FileApp", hInstance, hPrevInstance,
  82.       lpCmdLine, nCmdShow);
  83.     FileApp.Run();
  84.     return FileApp.Status;
  85. }
  86.  
  87.